/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package db;

import Control.DataManager;
import Model.User;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Jayson Kiong
 */
public class UpdateUserStatus extends HttpServlet {
private DataManager dataManager;
    private User user;
    
   @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        
        Connection con = DBConnector.connect();
       
        
        try{

        String id = request.getParameter("userID");
            
        PreparedStatement ps = con.prepareStatement
            ("UPDATE quicklenddb.user SET status = 1 where userID=?");
                
                
                ps.setInt(1, Integer.valueOf(id));
             
                
                ps.executeUpdate();
                
                
                response.sendRedirect("ApproveUserServlet");
            
            
        }catch(SQLException e)
        {
            System.out.println(e); 
        }
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>
}
